// gray.frag.js
module.exports =
`
#ifdef GL_ES
precision lowp float;
#endif

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
void main()
{   
    float ratio=0.0; 
    vec4 texColor = texture2D(CC_Texture0, v_texCoord);
    ratio = texColor[0] + texColor[1] + texColor[2] ;
    if (ratio < 1.45)
    {   
        texColor[0] = texColor[0] / ratio ;
        texColor[1] = texColor[1] / ratio ;
        texColor[2] = texColor[2] / ratio ;
        texColor[3] = texColor[3] / ratio ;
    }
    else
    {
        texColor[3] = 0.0 ;
    }
    gl_FragColor = v_fragmentColor*texColor ;
}
`
/*
 `
#ifdef GL_ES
precision lowp float;
#endif

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
void main()
{
    vec4 c = v_fragmentColor * texture2D(CC_Texture0, v_texCoord);
    gl_FragColor.xyz = vec3(0.2126*c.r + 0.7152*c.g + 0.0722*c.b);
    gl_FragColor.w = c.w;
}
`
*/